import mongoose from '../config/DBHelpler'

const Schema = mongoose.Schema

const AdsSchema = new mongoose.Schema({
  title: { type: String },
  contents: { type: Array },
})

// AdsSchema.pre('save', function(next){
//     this.created = moment().format('YYYY-MM-DD HH:mm:ss' )
//     next()
//   })
// SignRecordSchema.statics = {
//     findByUid: function(uid){
//       return this.findOne({ uid: uid }).sort({created: -1}
//       // return this.findOne({ uid: uid }
//       )}
//   }

const AdsSchemaModel = mongoose.model('advertisement', AdsSchema)

export default AdsSchemaModel
